$def with ()

<ul>
$if "recentchanges_v2" in ctx.features:
    $def call_template(name, change):
        $ t = get_template("recentchanges/" + change.kind + "/" + name) or get_template("recentchanges/default/" + name)
        $:t(change)

    $ messages = get_random_recent_changes(4)
    $for m in messages:
        <li class="history">$:m</li>
$else:
    $ changes = get_random_recent_changes(4)
    $for v in changes:
        $if v.author:
            $ who = '<a href="%s" rel="nofollow">%s</a>' % (v.author.key, v.author.displayname or v.author.key)
        $else:
            $ who = None
        $if v.thing.type.key == '/type/work':
            $ what = v.thing.title or v.key
        $elif v.thing.type.key == '/type/edition':
            $ what = v.thing.get('title_prefix', '') + v.thing.get('title', '')
            $if not what:
                $ what = v.key
        $elif v.thing.type.key == '/type/author':
            $ what = v.thing.name or v.key
        $else:
            $ what = v.key
        $ what = '<a href="%s" rel="nofollow">%s</a>' % (v.key, what)
        $ when = datestr(v.created)
        <li class="history">
            $if v.revision == 1:
                $ action = "created"
            $else:
                $ action = "updated"

            $if v.revision == 1 and v.author and v.author.key == v.key:
                $:who $_('opened a new Open Library account!')
            $elif who:
                $:who $action $:what
            $else:
                $:what was $action anonymously
            <span class="timestamp">$when</span>
        </li>
<li class="history around-the-library-link"><a href="/recentchanges" title="$_('View all recent changes')">$_("Around the Library")</a> &rarr;</li>
</ul>
